package com.ykz2015.chapter3.props;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
//如果不想一个参数一个参数的去配置，可以按照下面这样写，那么就可以把drivername..password等的Value依次赋值省略。此注解可能出现 spring boot configuration annotation processor not found in classpath问题。可以通过增加注释处理器
// <dependency>
//	<groupId>org.springframework.boot</groupId>
//	<artifactId>spring-boot-configuration-processor</artifactId>
//	<optional>true</optional>
//</dependency>
@ConfigurationProperties("database")
public class DataBaseProperties {
    //@Value("${database.driverName}")
    private String driverName;

    //@Value("${database.url}")
    private String Url;

    //@Value("${database.username}")
    private String userName;

    //@Value("${database.password}")
    private String passWord;

    public String getDriverName() {
        return driverName;
    }

    public String getUrl() {
        return Url;
    }

    public String getUserName() {
        return userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setDriverName(String driverName) {
        this.driverName = driverName;
    }

    public void setUrl(String url) {
        Url = url;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }
}
